(setq package-enable-at-startup nil)
(setq package-archives
      '(("melpa-cn" . "http://mirrors.tuna.tsinghua.edu.cn/elpa/melpa/")
        ("org-cn"   . "http://mirrors.tuna.tsinghua.edu.cn/elpa/org/")
        ("gnu-cn"   . "http://mirrors.tuna.tsinghua.edu.cn/elpa/gnu/")))

(package-initialize)

(setq backup-directory-alist (quote (("." . "~/.emacs.d/backups"))))
(setq inhibit-startup-screen t)
(setq delete-by-moving-to-trash t)
(setq create-lockfiles nil)

(use-package ivy
  :ensure t
  :diminish ivy-mode
  :config
  (setq ivy-initial-inputs-alist nil)
  :hook (after-init . ivy-mode))

(use-package counsel
  :ensure t
  :diminish counsel-mode
  :config (ivy-mode t)
  :bind(("M-X" . counsel-command-history)
        ("C-; r" . counsel-recentf)
        ("C-; f" . counsel-git)
        ("C-; s" . counsel-rg))
  :hook (after-init . counsel-mode))

(use-package which-key
  :ensure t
  :diminish which-key-mode
  :hook (after-init . which-key-mode))

(use-package org
  :ensure t
  :diminish org-mode
  :hook (after-init . org-mode))

(use-package elpy
  :ensure t
  :diminish elpy-mode
  :hook (after-init . elpy-mode))

(use-package company
  :ensure t
  :diminish company-mode

  :hook (after-init . company-mode))

(use-package citre 
  :ensure t
  :diminish citre-mode
  :bind(("C-; j" . citre-jump)
        ("C-; J" . citre-jump-back)
        ("C-; p" . citre-peek)
        ("C-; u" . citre-update-this-tags-file)
        ("C-; U" . citre-update-tags-file))
  :hook (after-init . citre-mode))

(add-hook 'python-mode-hook
          (lambda ()
            (hs-minor-mode t)
            (elpy-enable)
            (company-mode t)
            (setq indent-tabs-mode t)
            (setq python-indent-offset 4)
            (setq tab-width 4)))

(add-hook 'emacs-lisp-mode-hook
          (lambda ()
            (setq indent-tabs-mode nil)
            (setq tab-width 2)))

(add-hook 'after-init-hook 
  (lambda() 
    (server-start)
  (evil-mode t)))

(run-with-idle-timer 2 nil (lambda() (counsel-mode t)))
(run-with-idle-timer 3 nil (lambda() (which-key-mode t)))

(add-to-list 'load-path "~/.emacs.d/snails")
(require 'snails)

(custom-set-faces
 ;; custom-set-faces was added by Custom.
 ;; If you edit it by hand, you could mess it up, so be careful.
 ;; Your init file should contain only one such instance.
 ;; If there is more than one, they won't work right.
 '(whitespace-space ((t (:foreground "#ff3436"))))
 '(whitespace-tab ((t (:foreground "#909090")))))

(setq whitespace-style '(face tabs tab-mark spaces space-mark newline newline-mark))

(setq whitespace-display-mappings
  '((tab-mark 9 [187 9] [92 9])
    (space-mark 32 [32] [64])))

(global-whitespace-mode t)
(custom-set-variables
 ;; custom-set-variables was added by Custom.
 ;; If you edit it by hand, you could mess it up, so be careful.
 ;; Your init file should contain only one such instance.
 ;; If there is more than one, they won't work right.
 '(ansi-color-faces-vector
   [default default default italic underline success warning error])
 '(custom-enabled-themes '(tango-dark))
 '(custom-safe-themes
   '("3d54650e34fa27561eb81fc3ceed504970cc553cfd37f46e8a80ec32254a3ec3" "97db542a8a1731ef44b60bc97406c1eb7ed4528b0d7296997cbb53969df852d6" "0b3aee906629ac7c3bd994914bf252cf92f7a8b0baa6d94cb4dfacbd4068391d" "f91395598d4cb3e2ae6a2db8527ceb83fed79dbaf007f435de3e91e5bda485fb" "da186cce19b5aed3f6a2316845583dbee76aea9255ea0da857d1c058ff003546" "a9a67b318b7417adbedaab02f05fa679973e9718d9d26075c6235b1f0db703c8" "7a7b1d475b42c1a0b61f3b1d1225dd249ffa1abb1b7f726aec59ac7ca3bf4dae" "4133d2d6553fe5af2ce3f24b7267af475b5e839069ba0e5c80416aa28913e89a" "b0e446b48d03c5053af28908168262c3e5335dcad3317215d9fdeb8bac5bacf9" "d47f868fd34613bd1fc11721fe055f26fd163426a299d45ce69bef1f109e1e71" "b5803dfb0e4b6b71f309606587dd88651efe0972a5be16ece6a958b197caeed8" "1d5e33500bc9548f800f9e248b57d1b2a9ecde79cb40c0b1398dec51ee820daf" "1f1b545575c81b967879a5dddc878783e6ebcca764e4916a270f9474215289e5" "e8df30cd7fb42e56a4efc585540a2e63b0c6eeb9f4dc053373e05d774332fc13" "9f9fc38446c384a4e909b7220d15bf0c152849ef42f5b1b97356448612c77953" "6b1abd26f3e38be1823bd151a96117b288062c6cde5253823539c6926c3bb178" "1704976a1797342a1b4ea7a75bdbb3be1569f4619134341bd5a4c1cfb16abad4" "d268b67e0935b9ebc427cad88ded41e875abfcc27abd409726a92e55459e0d01" "745d03d647c4b118f671c49214420639cb3af7152e81f132478ed1c649d4597d" default))
 '(display-line-numbers-type nil)
 '(display-time-mode t)
 '(global-display-line-numbers-mode t)
 '(indicate-empty-lines t)
 '(package-selected-packages '(evil-mc markdown-mode doom-themes use-package))
 '(show-paren-mode t)
 '(tool-bar-mode nil))

(put 'narrow-to-page 'disabled nil)
